package com.tianji.learning.controller;


import com.tianji.common.domain.dto.PageDTO;
import com.tianji.learning.domain.dto.ReplyDTO;
import com.tianji.learning.domain.query.ReplyPageQuery;
import com.tianji.learning.domain.vo.ReplyVO;
import com.tianji.learning.service.IInteractionReplyService;
import com.tianji.learning.service.impl.InteractionReplyServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 互动问题的回答或评论 前端控制器
 * </p>
 *
 * @author liuchun
 * @since 2024-08-30
 */
@Api(tags = "回答或评论相关接口")
@RestController
@RequestMapping("/replies")
public class InteractionReplyController {


    @Autowired
    private IInteractionReplyService replyService;

    /**
     * 新增评论或者回复
     */
    @PostMapping
    @ApiOperation("新增评论或者回复")
    public void addReply(@RequestBody @Validated ReplyDTO replyDTO){
         replyService.addReply(replyDTO);
    }

    /**
     * 分页查询评论或者回答列表
     * @param pageQuery
     * @return
     */
    @GetMapping("/page")
    @ApiOperation("新增评论或者回复")
    public PageDTO<ReplyVO> pageReply(ReplyPageQuery pageQuery){
         return replyService.pageReply(pageQuery);
    }

}
